if [ ! -s ${TMPDIR}/.book_files.$$ -o -z "`grep doc ${TMPDIR}/.book_files.$$`" ] ; then
echo "No .doc's on BOOK_FILES line in Makefile, checking sgms...\n"
else
echo "Checking for archived .docs not in the Makefile..."
for file in `/bin/ls ${dir}/*.doc` ; do
docfile=`basename $file`
if [ -z "`grep ${docfile} ${TMPDIR}/.book_files.$$`" ] ; then
echo $docfile
fi
done
echo "\nChecking for missing .sgm files..."
for file in `cat ${TMPDIR}/.book_files.$$` ; do
sgmfile=`echo $file | sed 's/\.doc/\.sgm/'`
if [ -z "`ls ${dir}/${sgmfile} 2> /dev/null`" ] ; then
echo $file
fi
done
echo "\nChecking for extra .sgm files..."
for file in `/bin/ls ${dir}/*.sgm` ; do
filename=`basename $file`
if [ -z "`grep ${filename} ${TMPDIR}/.valid_sgm_files.$$`" ] ; then
echo $filename
fi
done
echo "\nChecking for possible other extra files/dirs..."
/bin/ls -1 ${dir} | sed '/^online$/d' | sed '/^orig$/d' | sed '/^print$/d' | sed '/^.*\.doc$/d' | sed '/^.*\.sgm$/d' | sed '/^Makefile$/d' | sed '/^prod$/d' | sed '/^RCS$/d' | sed '/^help$/d' | sed '/^.*\.book$/d'
# check help refs
if [ -d ${dir}/help ] ; then
echo "\nChecking help references (this may take a moment)..."
for helpmap in `/bin/ls ${dir}/help/*.helpmap` ; do
valid_helpmap="F"
for helptopic in `cat $helpmap | sed 's/^\([^;]*;\)\([^;]*;\)\([^;]*;\)\([^;]*;\)\([^;]*\);.*$/\5/' | sed '/#.*/d'`; do
if [ -z "`grep ${helptopic} $valid_sgm_files`" ] ; then
echo "$helptopic in `basename $helpmap` does not exist in any valid sgm file"
else
valid_helpmap="T"
fi
done
if [ $valid_helpmap = "F" ] ; then
echo "WARNING: `basename $helpmap` does not contain any valid entries"
fi
done
fi
# pull out refs in doc files to figs in print dir
echo "\nworking on fig refs\c"
for file in `cat ${TMPDIR}/.book_files.$$ | grep doc` ; do (strings ${dir}/$file | grep "<c>print<c>" | sed 's/.*<c>\(.*\)<U>.*/\1/' >> ${TMPDIR}/.figlist.$$ ; echo ".\c" ) ; done
rm ${TMPDIR}/.book_files.$$
# look for figs in Makefile, but not in orig
echo "\n\nChecking for fig files in orig, but not in Makefile..."
if [ -f ${TMPDIR}/.figs_make.$$ ] ; then rm ${TMPDIR}/.figs_make.$$ ; fi
touch ${TMPDIR}/.figs_make.$$
awk '/^PRINT_BW/,/[^\\]$/' ${dir}/Makefile | sed 's/^PRINT_BW *= *//' | sed s'/\\$//' | sed 's/\.rgb/\.bw/g' >> ${TMPDIR}/.figs_make.$$
awk '/^PRINT_COLOR/,/[^\\]$/' ${dir}/Makefile | sed 's/^PRINT_COLOR *= *//' | sed s'/\\$//' | sed 's/\.rgb/\.clr/g' >> ${TMPDIR}/.figs_make.$$
awk '/^PostScript/,/[^\\]$/' ${dir}/Makefile | sed 's/^PostScript *= *//' | sed s'/\\$//' >> ${TMPDIR}/.figs_make.$$
for file in `cat ${TMPDIR}/.figs_make.$$` ; do
fullpath=${dir}/orig/`echo $file | sed 's/\.bw/\.rgb/' | sed 's/\.clr/\.rgb/'`
if [ -z "`ls $fullpath 2> /dev/null`" ] ; then
echo $file
fi
done
# look for figs in orig, but not in Makefile
echo "\n\nChecking for fig files in orig, but not in Makefile..."
for file in `/bin/ls orig` ; do
if [ -z "`grep $file Makefile 2> /dev/null`" ] ; then echo $file ; fi
done
# compare ref'd figs against figs in Makefile
echo "\nChecking for fig files in the Makefile, but not ref'd in valid .doc's..."
for file in `cat ${TMPDIR}/.figs_make.$$` ; do
if [ -z "`grep \"^${file}$\" ${TMPDIR}/.figlist.$$`" ] ; then
echo $file
fi
done
rm ${TMPDIR}/.figs_make.$$
# if there are any refs to figs in the print dir
if [ ! -s ${TMPDIR}/.figlist.$$ ] ; then
echo "no imported figures in doc files\n"
rm ${TMPDIR}/.figlist.$$
else
# if there's a print dir
if [ ! -d ${dir}/print ] ; then
echo "no print dir"
else
echo "\nChecking for figs in print, but not ref'd in valid .doc's..."
for file in `/bin/ls ${dir}/print` ; do
if [ -z "`grep $file ${TMPDIR}/.figlist.$$`" ] ; then
echo $file | sed '/^RCS$/d'
fi
done
echo "\nChecking for files referenced in valid .doc's, but not in print/..."
for file in `cat ${TMPDIR}/.figlist.$$` ; do
if [ -z "`ls ${dir}/print/${file} 2> /dev/null`" ] ; then
echo $file
fi
done
echo
fi
rm ${TMPDIR}/.figlist.$$
fi # if there are any imported figures
fi # if there are any .docs listed in the Makefile
fi # if there is a Makefile
# if there's sgms and an online dir
if [ -s ${TMPDIR}/.valid_sgm_files.$$ -a -d ${dir}/online ] ; then
echo "Checking for figs in online not ref'd in valid sgm's..."
for file in `/bin/ls ${dir}/online` ; do
if [ -z "`grep $file $valid_sgm_files`" ] ; then
echo $file | sed '/^RCS$/d'
fi
done
echo "\nChecking for files referenced in valid sgm's, but not in online/..."
for file in `grep "GRAPHIC FILE=" $valid_sgm_files | sed 's/^.*GRAPHIC FILE=\"\([^"]*\)\".*$/\1/'` ; do
if [ -z "`ls ${dir}/online/${file} 2> /dev/null`" ] ; then